<#cenluan title="发起活动" menu="activity" markdown="true" validate="true" datepicker="true">
	<ol class="breadcrumb mb20">
		<li><a href="/activity">活动</a></li>
		<li class="active">发起活动</li>
	</ol>
	<form class="form-horizontal" method="post" id="activityForm">
		<div class="form-group">
			<label class="control-label col-md-2">标题</label>
			<div class="col-md-10">
				<input class="form-control" type="text" name="activity.title"
				 required minlength="3" maxlength="32" placeholder="标题在3-32字之间">
			</div>
		</div>	
		<div class="form-group">
			<label class="control-label col-md-2">时间</label>
			<div class="col-md-5">
				<input class="form-control date-field" type="text" name="activity.start" 
				required value="${date(),'yyyy-MM-dd HH:mm:00'}">
			</div>
			<div class="col-md-5">
				<input class="form-control date-field" type="text" name="activity.end" 
				required value="${date(),'yyyy-MM-dd HH:mm:00'}">
			</div>
		</div>	
		<div class="form-group">
			<label class="control-label col-md-2">内容</label>
			<div class="col-md-10">
				<textarea name="activity.content" id="content"></textarea>
			</div>
		</div>	
		<div class="form-group">
			<div class="col-md-3 col-md-offset-2">
				<button class="btn btn-primary btn-block" type="submit">提交</button>
			</div>
		</div>	
	</form>
	<script>
		$(function(){
			//markdown
			$("#content").markdown({
				language : "zh",
				resize : "vertical",
				fullscreen : false,
				width : "100%",
				height : "300"
			});
			$(".date-field").datetimepicker({
				format:"yyyy-mm-dd hh:ii:ss",
				todayBtn:true,
				todayHighlight:true,
				language:"zh-CN"
			});
			$("#activityForm").validate({
				submitHandler:function(form){
					$(form).find(":submit").button("loading");
					$(form).ajaxSubmit({
						url:"/activity/save",
						success:function(json){
							if(!json.ok){
								$(form).find(":submit").button("reset");
								alert(json.msg);
							}else{
								location="/activity";
							}
						}
					});				
				}
			});
		});
	</script>
</#cenluan>